package com.zr.controller.dispatch;

import com.github.pagehelper.PageInfo;
import com.zr.service.dispatch.DispatchDelayRecordService;
import com.zr.utils.AjaxResult;
import com.zr.vo.dispatch.DispatchDelayRecord;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @author 杜雨萌
 * @date 2022/10/29
 * @version 2022.1
 */
@RestController
@RequestMapping("/dispatch/delay")
public class DispatchDelayRecordController {

    @Resource
    private DispatchDelayRecordService dispatchDelayRecordService;


    /**
     * 获得异常列表
     * @author 杜雨萌
     * @param dispatchDelayRecord
     * @return
     */
    @PostMapping("/list")
    public AjaxResult list(@RequestBody DispatchDelayRecord dispatchDelayRecord){
        PageInfo<DispatchDelayRecord> pageInfo = dispatchDelayRecordService.list(dispatchDelayRecord);
        return AjaxResult.success(200,"查询成功",pageInfo);
    }
    /**
     * 查询近7天延误数
     * @return
     */
    @PostMapping("/getTicketDelayRecentWeek")
    public AjaxResult getTicketDelayRecentWeek(){
        return AjaxResult.success(200,"查询成功",dispatchDelayRecordService.getTicketDelayRecentWeek());
    };
    /**
     * 查询近1个月延误数
     * @return
     */
    @PostMapping("/getTicketDelayRecentMonth")
    public AjaxResult getTicketDelayRecentMonth(){
        return AjaxResult.success(200,"查询成功",dispatchDelayRecordService.getTicketDelayRecentMonth());
    };
    /**
     * 查询近今年延误数
     * @return
     */
    @PostMapping("/getTicketDelayThisYear")
    public AjaxResult getTicketDelayThisYear(){
        return AjaxResult.success(200,"查询成功",dispatchDelayRecordService.getTicketDelayThisYear());
    };

}
